#ifndef _DSWAX_CLIENT_H
#define _DSWAX_CLIENT_H
#include <libbase/dswbase.h>

typedef 	std::list<CMarkup*> LIST_X03_PTZ_CMD_T, *LPLIST_X03_PTZ_CMD_T;

typedef struct{
	pthread_mutex_t nLock;
	LIST_X03_PTZ_CMD_T nList_Used[MAX_CHANNEL_REMOTE];
	LIST_X03_PTZ_CMD_T nList_UnUsed;
} ST_X03_PTZ_CMD_T, *LPST_X03_PTZ_CMD_T;

class CDswax_client : public CDswbase
{
public:
	CDswax_client(LPST_ENV_T pEnv);
	virtual ~CDswax_client();
public:
	static void cbAXMsgFunc(EN_MSG_TYPE nType, char* pKey, void* pParam, void* pCaller){((CDswax_client*)pCaller)->AXMsgFunc(nType, pKey, pParam);};
private:
	void AXMsgFunc(EN_MSG_TYPE nType, char* pKey, void* pParam);
	
	static void* cbAXWorkingThreadFunc(void* pParam){((CDswax_client*)pParam)->AXWorkingThreadFunc();return NULL;};
	void AXWorkingThreadFunc();
private:
	void MakeAXMsgClient(LPST_EXTERNAL_CAM_EX_T pExtcam);
	void AXPrepare();

	CMarkup* GetX03PTZCmdNode(LPLIST_X03_PTZ_CMD_T pList);
	void PutX03PTZCmdNode(LPLIST_X03_PTZ_CMD_T pList, CMarkup *pXml);
	LPST_ASYNCHRONOUS_CMD_T GetCmdNode(LPLIST_ASYNCHRONOUS_CMD_T pList);
	void PutCmdNode(LPLIST_ASYNCHRONOUS_CMD_T pList, LPST_ASYNCHRONOUS_CMD_T pNode);
	void ProcessAsynCmd();
	void ProcessPTZAction(LPST_ASYNCHRONOUS_CMD_T pCmd);
private:
	virtual int OnMessage(EN_MSG_TYPE nMsgType, void * pParam);
private:
	ST_EXTCAM_TAB_T m_nExtcamTab;
	pthread_t m_nThread_Descover, m_nThread_OnvifWorking;
	ST_ASYNC_CMD_T m_nAsyncCmd;
	ST_X03_PTZ_CMD_T m_nX03PTZCmd;
	ST_DEVICE_BASE_T m_nBaseParam;
};

#endif

